package com.thread.threadfirst.marvel.citymaster.enums;

import lombok.Getter;

/**
 * 渠道  1 信用卡申请 2 返现
 */
@Getter
public enum IncomeChannel {
    IC0(-1, ""),
    IC1(1, "信用卡申请"),
    IC2(2, "提现"),
    IC3(3, "会员产品渠道");


    /**
     *
     */
    private final String description;
    /**
     *
     */
    private final Integer value;


    /**
     * @param value
     * @param description
     */
    IncomeChannel(int value, String description) {
        this.value = value;
        this.description = description;
    }

    /**
     * 根据key获取枚举
     *
     * @param key
     * @return
     */
    public static IncomeChannel getEnumByKey(Integer key) {
        if (null == key) {
            return null;
        }
        for (IncomeChannel temp : IncomeChannel.values()) {
            if (temp.value.equals(key)) {
                return temp;
            }
        }
        return null;
    }
}
